<html>
<head><meta charset="utf-8"><title>must_not_await lint · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html">must_not_await lint</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="213844964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213844964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213844964">(Oct 19 2020 at 20:58)</a>:</h4>
<p>So <span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> and <span class="user-mention" data-user-id="207781">@Lucio Franco</span> have drafted up a <a href="https://github.com/rust-lang/wg-async-foundations/blob/master/rfc-drafts/must_not_await_lint.md">draft <code>must_not_await</code> RFC</a>. It basically proposes a lint exactly like <code>#[must_use]</code> called <code>#[must_not_await]</code> for designating values that should not be live across an await point. <span class="user-group-mention" data-user-group-id="1977">@T-lang</span> I think this RFC is more-or-less ready to be opened, but wanting to request feedback from folks before doing so.</p>
<p>To me the biggest unresolved question is also an unresolved question for <code>#[must_use]</code>, and ought to be handled together: how much do we care about "must-use" (or "must-not-await") structs that are embedded within other structs?</p>



<a name="213845216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213845216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213845216">(Oct 19 2020 at 21:00)</a>:</h4>
<p>We decided we care enough to propagate it for tuples, right?</p>



<a name="213845530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213845530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213845530">(Oct 19 2020 at 21:03)</a>:</h4>
<p>I think we did</p>



<a name="213847828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213847828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213847828">(Oct 19 2020 at 21:20)</a>:</h4>
<p>We talked about fully general propagation mechanisms, but I don't object to special-casing <code>must_not_await</code> for specific types (the same ones as <code>must_use</code>) for now.</p>



<a name="213847843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213847843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213847843">(Oct 19 2020 at 21:20)</a>:</h4>
<p>Also, <code>must_not_await</code> is a <em>really</em> confusing name to me.</p>



<a name="213847852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213847852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213847852">(Oct 19 2020 at 21:20)</a>:</h4>
<p>It sounds like "you must not <code>.await</code> this value".</p>



<a name="213847870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213847870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213847870">(Oct 19 2020 at 21:20)</a>:</h4>
<p>Not "you must not await with this value live".</p>



<a name="213847962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213847962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213847962">(Oct 19 2020 at 21:21)</a>:</h4>
<p>I'd favor verbosity like <code>must_not_live_across_await</code> for clarity, if we can't come up with something shorter that's as clear.</p>



<a name="213848190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213848190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213848190">(Oct 19 2020 at 21:23)</a>:</h4>
<p>Do we want to already dive into the <code>await</code> case? Because I can imagine the same happening with generators...</p>



<a name="213848260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213848260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213848260">(Oct 19 2020 at 21:24)</a>:</h4>
<p><code>#[should_not_cross_yield_points]</code></p>



<a name="213848332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213848332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213848332">(Oct 19 2020 at 21:25)</a>:</h4>
<p>(I find <code>must</code> a bit too strong, although I guess that ship has sailed with <code>#[must_use]</code>)</p>



<a name="213848400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213848400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213848400">(Oct 19 2020 at 21:25)</a>:</h4>
<p><code>must_not_suspend</code>?</p>



<a name="213848675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213848675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213848675">(Oct 19 2020 at 21:28)</a>:</h4>
<p>Provided the error message / documentation etc. explain what the rfc already does well enough (the <code>MutexGuard</code> example is nice, if we strip the <code>!Send</code> technicality that is just noise teachability-wise), then the terse <code>#[must_not_suspend]</code> looks, imho, like a good compromise <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="213848974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213848974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213848974">(Oct 19 2020 at 21:30)</a>:</h4>
<p><code>#[dont_send_over_suspend]</code> - rhyming makes it easier to remember ;)</p>



<a name="213851792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/must_not_await%20lint/near/213851792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/must_not_await.20lint.html#213851792">(Oct 19 2020 at 21:59)</a>:</h4>
<p>I agree that the name <code>#[must_not_await]</code> is confusing</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>